package com.hckjsec.common;

import com.hckjsec.common.general.MapLongNameView;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

//记录一些常用方法说明
public class HckjDemoData {
//将list类中某一对象转换成list<String>       list                         类名           对象
//    List<String> vlues = oaLegalDate.getSupplyList().stream().map(ListStringView::getValue).collect(Collectors.toList());
//将List<String>转换成数组
    //list.toArray(new String[list.size()])
    //list.toArray(new Integer[list.size()])
    //1.使用Stream   String[] ss = listStrings.stream().toArray(String[]::new);
    //2.List中的toArray()方法   String[] sss = listStrings.toArray(new String[listStrings.size()]);
//将数组转成成List<String>
//    集合
//    List<DictEntity> dictEntityList = dictService.findByType(6);
//    取出属性为集合
//    List<String> stateNameList = dictEntityList.stream().map(DictEntity::getName).collect(Collectors.toList());
//    取出属性为数组
//    Long[] ids = dictEntityList.stream().map(DictEntity::getId).toArray(Long[]::new);
//    集合去重
//dictEntityList.stream().distinct().collect(Collectors.toList());
// 数组
    //1.使用Stream   List<String> listStrings = Stream.of(arr).collect(Collectors.toList());
    //2.List中的toArray()方法   List<String> listStrings = Arrays.asList(arr);
//list对象求和                   类名               对象
    //list.stream().mapToLong(LawHomeEvaluate::getNoSatisfied).sum()
// 数组转字符串(逗号分隔)(推荐)
//StringUtils.join(arr, ",");
//List<String>逗号分隔    String result = list.stream().map(String::valueOf).collect(Collectors.joining(","));
//List<String> 进行分组求数量
// Map<String,Long> collect = groupList.stream().collect(Collectors.groupingBy(
//                Function.identity(), Collectors.counting()
//        ));
//    kv.setProvinceArr(mxList.stream().map(BookLogisticsMx::getProvince).collect(Collectors.joining(",")));
    ////将集合中TestDemo 对象name值以逗号⽅式隔开转为字符串
//String names = testDemos.stream().map(TestDemo::getName).collect(Collectors.joining(","))
//排序
//MechanismRankingList.sort(Comparator.comparing(MechanismRanking::getNumber));
    //String aa = "1,2,3";
//    List<String> list = Arrays.asList(aa.split(","));
public static void main(String[] args) {
//    List<MapLongNameView> groupList = new ArrayList<>();
//    groupList.add(new MapLongNameView("1",1L));
//    groupList.add(new MapLongNameView("1",1L));
//    groupList.add(new MapLongNameView("0",1L));
//    groupList.add(new MapLongNameView("2",1L));

//        Map<String,Double> collect = list.stream().collect(Collectors.groupingBy(User: :getEdu,
//                //对参数进行累计求和
//                Collectors.summingDouble(User: :getPrice)));
//        System.out.println(collect)
//list转成指定字符的字符串   StringUtils.join(relativePath.toArray(),";")
    List<String> groupList   = new ArrayList<>();
    groupList.add("11");
    groupList.add("11");
    groupList.add("22");
    groupList.add("22");
    groupList.add("22");
    groupList.add("33");
    groupList.add("44");
    groupList.add("44");
    test4(groupList);

}
    public static void test4(List<String> groupList) {
        List<String> openidList = new ArrayList<>();
        System.out.println(openidList.size());
//        Map<String,Long> collect = groupList.stream().collect(Collectors.groupingBy(
//                Function.identity(), Collectors.counting()
//        ));
//        System.out.println(collect);
    }
}


